<template>
  <div class="tablewrap">
    <div>新能源告警信息</div>
    <FilterTable :columns="columns" :isColumnFilter="false" :dataSource="dataSource" :height="200" :onColumnsChange="columns => (this.columns = columns)"></FilterTable>
  </div>
</template>

<script>
import moment from 'moment';
import { newEnergyWarning } from '@/api/repair/repairReception/customer/monitoring.js';

export default {
  name: 'XinNengYuan',
  props: {
    queryParams: Object
  },
  data() {
    return {
      // 告警信息
      dataSource: [],
      columns: this.createAlarmInformationNew()
    };
  },
  mounted() {
    this.newEnergyWarning();
  },
  methods: {
    async newEnergyWarning() {
      const params = {
        sort: 'WARNING_NO',
        order: 'asc',
        ...this.queryParams
        // LICENSE: '陕A2FU00',
        // vin: '09876543219876543',
        // ownerNo: 'OW1907110001',
        // BRAND: 'LINCOLN',
        // MILEAGE: '999999',
        // isRepairOrder: 'REPAIR_ORDER_TAG',
        // createDate: moment().format('YYYY-MM-DD HH-mm'), //'2019-08-14 20:20',
        // dmsFuncId: 35100010,
        // _: moment().valueOf()
      };
      const res = await newEnergyWarning(params);
      this.dataSource = res;
    },
    createAlarmInformationNew() {
      return [
        {
          title: '序号',
          dataIndex: ''
        },
        {
          title: '告警编号',
          dataIndex: 'WARNING_NO'
        },
        {
          title: '告警级别',
          dataIndex: 'WARNING_CLASS'
        },
        {
          title: '告警名称',
          dataIndex: 'WARNING_NAME'
        },
        {
          title: '告警时间',
          dataIndex: 'FIRST_REPORT_TIME'
        },
        {
          title: '告警地点',
          dataIndex: 'FIRST_REPORT_LOCATION'
        },
        {
          title: '里程',
          dataIndex: 'ODOMETER'
        }
      ];
    }
  }
};
</script>

<style scoped></style>
